

package com.atguigu.gulimall.ware.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * mybatis-plus配置
 * 开启事务
 * @author Mark sunlightcs@gmail.com
 */
@EnableTransactionManagement
@Configuration
@MapperScan(basePackages = "com.atguigu.gulimall.ware.dao")
public class MybatisPlusConfig {

    /**
     * 分页插件
     */
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        PaginationInterceptor paginationInterceptor=new PaginationInterceptor();
        // 请求的页面大于最大页后 回到第一页
        paginationInterceptor.setOverflow(false);
        paginationInterceptor.setLimit(1000);
        return new PaginationInterceptor();
    }

}
